<template>
	<SearchForm :columns="formColumn" @search="search" @reset="search" />
	<el-header>
		<div class="left-panel">
			<el-button icon="el-icon-download">导出</el-button>
		</div>
	</el-header>
	<el-main class="nopadding">
		<scTable
			ref="table"
			tableName="studentList"
			v-bind="list"
			row-key="id"
			stripe
		>
			<el-table-column type="selection" width="50"></el-table-column>
			<template #type="scope">
				<el-link
					type="primary"
					:underline="false"
					:href="`#/student/info/detail/${scope.row.id}`"
					>{{ scope.row.type }}</el-link
				>
			</template>
			<template #subType="scope">
				<el-link
					type="danger"
					:underline="false"
					:href="`#/student/info/detail/${scope.row.id}`"
					>{{ scope.row.subType }}</el-link
				>
			</template>
			<template #memory="scope">
				<el-link
					type="danger"
					:underline="false"
					:href="`#/student/info/detail/${scope.row.id}`"
					>{{ scope.row.subType }}</el-link
				>
			</template>
		</scTable>
	</el-main>
</template>

<script>
import SearchForm from "@/components/SearchForm/index.vue";
import { formColumn, column } from "./data";

export default {
	components: {
		SearchForm,
	},
	data() {
		return {
			formColumn,
			list: {
				apiObj: this.$API.student.studentSchedule,
				params: {
					studentId: parseInt(this.$route.params.id)
				},
				column,
			},
		};
	},
	methods: {
		search(searchParams) {
			let params = {}
			if(searchParams) {
				const searchObj = JSON.parse(JSON.stringify(searchParams))
				params = Object.assign({}, searchObj, this.list.params)
			}else{
				params = Object.assign({}, this.list.params, {});
			}
			this.$refs.table.reload(params);
		},
	},
};
</script>

